/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rhythm.commons.io;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 *
 * @author Michael J. Lee
 */
public class Streams {

    /**
     * Attempts to close the stream if it is not null.  Use this method for a
     * closing a steam without checking for a <code>null</code> state.
     *
     * @param stream nullable
     * @throws java.io.IOException
     */
    public static void close(OutputStream stream) throws IOException {
        if (stream != null) {
            stream.close();
        }
    }

    /**
     * Attempts to close the stream if it is not null.  Use this method for a
     * closing a steam without checking for a <code>null</code> state.
     *
     * @param stream nullable
     * @throws java.io.IOException
     */
    public static void close(InputStream stream) throws IOException {
        if (stream != null) {
            stream.close();
        }
    }
}
